package com.ch1;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.socket.SocketChannel;
import io.netty.handler.codec.DelimiterBasedFrameDecoder;
import io.netty.handler.codec.string.StringDecoder;

/**
 * @author U317076
 *
 */
public class ClientHandlerIniter  extends ChannelInitializer<SocketChannel>{

	@Override
	protected void initChannel(SocketChannel ch) throws Exception {

		System.out.println(">>>>> ININT CHANNEL");
		
		ByteBuf delimiter = Unpooled.copiedBuffer("$$".getBytes());
		ch.pipeline().addLast(new DelimiterBasedFrameDecoder(1024,delimiter));
		ch.pipeline().addLast(new StringDecoder());
		ch.pipeline().addLast(new EchoClientHandler());
		
	}

}
